package day23;

import java.io.*;

public class Demo5 {
    public static void main(String[] args) throws IOException {
        File in = new File("D:\\a\\b\\c\\qwe.mp4");
        File out = new File("D:\\a\\b\\g\\c\\abc.mp4");
        if (in.exists()) {
            File pout = out.getParentFile();
            if (!pout.exists()) {
                pout.mkdirs();
            }
            FileInputStream fis = null;
            FileOutputStream fos = null;
            try {
                long start = System.currentTimeMillis();
                fis = new FileInputStream(in);
                fos = new FileOutputStream(out);
                byte[] bs = new byte[1024];
                int len=0;
                while ((len=fis.read(bs))!=-1){
                    fos.write(bs,0,len);
                }
                long end = System.currentTimeMillis();
                System.out.println((end-start)+"ms");
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            finally {
                fis.close();
                fos.close();
            }
        }
        else {
            System.out.println("不存在");
        }
    }
}
